﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Windows.Data;
using bdnt_pets_system.Resources;
using System.Globalization;
using System.Threading;
using System.IO.IsolatedStorage;


namespace bdnt_pets_system.Tools
{
    public class LanguageConverter : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private MyStrings _strings = new MyStrings();
        public MyStrings Strings
        {            
            get { return _strings; }
        }

        public void ChangeCulture(string culture)
        {
            IsolatedStorageSettings.ApplicationSettings[SessionManager.ISCHINESE] = culture == "en-US" ? false : true;
            CultureInfo ci = new CultureInfo(culture);
            Thread.CurrentThread.CurrentUICulture = ci;
            Thread.CurrentThread.CurrentCulture = ci;
            
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Strings"));
            }            
        }

    }
}
